<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="inc/js.jsp"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>记录列表</title>
    <jsp:include page="inc/css.jsp"/>
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
    <jsp:include page="inc/menu.jsp"/>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-12">
                    <div class="card" style="margin-top: 10px">
                        <div class="card-body">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover" id="dataTables" style="width: 100%">
                                    <colgroup>
                                        <col class="gradeA even"/>
                                        <col class="gradeA odd"/>
                                        <col class="gradeA even"/>
                                        <col class="gradeA odd"/>
                                        <col class="gradeA even"/>
                                        <col class="gradeA odd"/>
                                    </colgroup>
                                    <thead>
                                    <tr>
                                        <th>类别</th>
                                        <th>内容</th>
                                        <th>金额</th>
                                        <th>类型</th>
                                        <th>记录时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <!-- /.card-body -->
                    </div>
                    <!-- /.card -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>
</div>
<!-- ./wrapper -->

<!-- page script -->
<script type="text/javascript">
    var _recordList = {
        v: {
            list: [],
            dTable: null,
            date: null
        },
        fn: {
            init: function () {
                _recordList.fn.dataTableInit();
            },
            dataTableInit: function () {
                _recordList.v.dTable = $safe.dataTable($('#dataTables'), {
                    "processing": true,
                    "serverSide": true,
                    "autoWidth": true,//自动计算宽度
                    "lengthChange": false,//是否允许记录改变表格每页显示的记录数
                    "searching": false,
                    "ordering": false,
                    "ajax": {
                        "url": "backend/moneyRecord/list",
                        "type": "POST"
                    },
                    "language": $safe.v.dataTableL,
                    "columns": [
                        {"data": null},
                        {"data": "content"},
                        {"data": "money"},
                        {"data": null},
                        {"data": null}
                    ],
                    "columnDefs": [
                        {}
                    ],
                    "createdRow": function (row, data, index) {
                        _recordList.v.list.push(data);

                        if (null != data.type) {
                            $('td', row).eq(0).html(data.type.name);
                        } else {
                            $('td', row).eq(0).html("");
                        }

                        if (data.status == 0) {
                            $('td', row).eq(3).html("支出");
                        } else {
                            $('td', row).eq(3).html("收入");
                        }

                        if (null != data.createTime) {
                            $('td', row).eq(4).html(crtTimeFtt(data.createTime));
                        } else {
                            $('td', row).eq(4).html("");
                        }
                    },
                    rowCallback: function (row, data) {

                    },
                    "fnServerParams": function (aoData) {

                    },
                    "fnDrawCallback": function (row) {
                        $safe.uiform();
                    }
                });
            }
        }
    };

    $(document).ready(function () {
        _recordList.fn.init();

        window.onload = function () {
            checkSelectMenu('baseLi');
        }
    });

</script>
</body>
</html>